<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="pragma" content="no-cache" />
        <meta http-equiv="cache-control" content="no-cache" />
        <meta http-equiv="expires" content="0" />
        <title></title>
        <link href="{{$http_url}}/css/css.css" rel="stylesheet" type="text/css" />
        <link href="{{$http_url}}/css/style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td height="30">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td height="62" background="{{$http_url}}/image/nav04.gif">
                                    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td width="21"></td>
                                            <td width="538"></td>
                                            <td width="144" align="left"></td>
                                        </tr>
                                    </table></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                                        <form  name="form1" method="post" action="{{$http_url}}/user/userList/">
                                            <tr>
                                                <td width="30%">
                                                    <label for="select2">用户名称：</label>
                                                    <input name="txtusername" type="text" size="25" {{if $txtusername}} value ="{{$txtusername}}" {{/if}} /></td>
                                                <td width="30%">
                                                    <label for="textfield">IC卡号：</label>
                                                    <input name="txtaudit" type="text" size="25" {{if $txtaudit}} value ="{{$txtaudit}}" {{/if}} />
                                                </td>
                                                <td><input type="submit" name="button" value="查 询" />&nbsp;&nbsp;&nbsp;<input type="button" name="buttonpiliang" id="buttonpiliang" value="批量授权" /></td>
                                            </tr></form>

                                        <tr>
                                            <td height="40" class="font42" colspan="4">
                                                <br>
                                                <table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#464646" class="newfont03">
                                                    <tr class="CTitle" >
                                                        <td height="22" colspan="10" align="center" style="font-size:16px">用户详细列表</td>
                                                    </tr>
                                                    <tr bgcolor="#EEEEEE">
                                                        <td width="6%"><input type="checkbox" name="piliang" id="checkbox" />批量授权</td>
                                                        <td width="8%">用户卡号</td>
                                                        <td width="10%">用户名称</td>
                                                        <td width="10%">姓名</td>
                                                        <td width="6%">所属部门</td>
                                                        <td width="10%">权限</td>
                                                        <td width="10%">登陆方式</td>
                                                        <td width="10%">用户创建时间</td>
                                                        <td width="14%" >操作</td>
                                                    </tr>
                                                    {{if $userlist}}
                                                    {{foreach from=$userlist item=list}}
                                                    <tr bgcolor="#FFFFFF" >
                                                        <td><center>{{if !is_numeric($list.is_admin)}}<input type="checkbox" name="checkbox" value="{{$list.id}}"/>{{/if}}</center></td>
                                                        <td>{{$list.card}}</td>
                                                        <td>{{$list.username}}</td>
                                                        <td>{{$list.nickname}}</td>
                                                        <td>{{if $list.groupname !="null"}}{{$list.group_nickname}}{{else}}空{{/if}}</td>
                                                        <td>{{if is_numeric($list.is_admin) && $list.is_admin ==2}}回收账号{{elseif is_numeric($list.is_admin) && $list.is_admin==1}}审核用户{{elseif is_numeric($list.is_admin) && $list.is_admin==0}}普通用户{{else}}未受权限{{/if}}</td>
                                                        <td>{{if is_numeric($list.login_land) && $list.login_land ==2}}USBKey登录{{elseif is_numeric($list.login_land) && $list.login_land ==3}}门户系统集成登录{{elseif is_numeric($list.login_land) && $list.login_land ==1}}用户名/密码登录{{else}}暂无登录方式{{/if}}</td>
                                                        <td>{{$list.joined_time|date_format:"%Y-%m-%d %T"}}</td>
                                                        <td> <a href="{{$http_url}}/user/updateUserDetail/?userid={{$list.id}}&type=1">修改密码</a> | <a href="{{$http_url}}/user/updateUserDetail/?userid={{$list.id}}&type=2">授权|取消授权</a> | {{if $list.is_forbidden==1}} <a href="{{$http_url}}/user/auth_lock_recovery_user/?userid={{$list.id}}&typeOper=2">恢复用户</a> {{else}} <a href="{{$http_url}}/user/auth_lock_recovery_user/?userid={{$list.id}}&typeOper=1">锁定用户</a> {{/if}}</td>
                                                    </tr>
                                                    {{/foreach}}
                                                    {{else}}
                                                    <tr bgcolor="#FFFFFF">
                                                        <td colspan="9">没有数据</td>
                                                    </tr>
                                                    {{/if}}
                                                </table></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        <script type="text/javascript" src="{{$http_url}}/js/jquery.min.js"></script>
        <script type="text/javascript" src="{{$http_url}}/js/authentication.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#checkbox").click(function(){
                    if($(this).attr("checked")){
                        $("[name=checkbox]").attr("checked",'true');
                    }else{
                        $("[name=checkbox]").removeAttr("checked");
                    }
                });
                $('input[name=checkbox]').click(function(){
                        if(!$(this).is(':checked')){
                            $(this).removeAttr("checked");
                            $("#checkbox").removeAttr("checked");
                        }
                    });
                $("#buttonpiliang").click(function(){
                    var check='';
                    $('input[name=checkbox]').each(function(){
                        if($(this).is(':checked')){
                            check+=$(this).val()+',';
                        }
                    });
                    if(check==''){
                        alert("请选择要授权的用户");
                        return;
                    }else{
                        if(confirm("批量授权的用户默认为普通用户权限,是否继续?")){
                            $.ajax({
                                type: "post",
                                url: "/user/shouquan/",
                                data: {checkids:check},
                                success: function(msg) {
                                    if(msg){
                                        alert("批量授权成功！");
                                        location.href='/user/userList/';
                                    }else{
                                        alert("批量授权失败！");
                                    }
                                }
                            });
                        }
                    }

                });
            })
        </script>
    </body>
</html>
